package com.hooya.fa.eu.biz.dao.repository.impl;

import com.hooya.fa.eu.biz.dao.entity.TempPkpy;
import com.hooya.fa.eu.biz.dao.mapper.stk.TempPkpyMapper;
import com.hooya.fa.eu.biz.dao.repository.TempPkpyRepository;
import com.hooya.fa.eu.biz.dao.wrapper.TempPkpyWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description 盘亏盘盈操作库
 * @Author : Zongz
 * @Copyright Copyright (c) 豪雅集团
 * @Create 2024/10/21
 * @Version 1.1.0
 */
@Slf4j
@Repository
@RequiredArgsConstructor
public class TempPkpyRepositoryImpl implements TempPkpyRepository {

    private final TempPkpyMapper tempPkpyMapper;

    @Override
    public List<TempPkpy> getByCondition(String place, String belongs, String date, List<String> skuList) {
        List<TempPkpy> res = tempPkpyMapper.selectList(
                TempPkpyWrapper.newQuery().eqPlace(place).eqBelongs(belongs).geDate(date).inSku(skuList));
        return CollectionUtils.isEmpty(res) ? new ArrayList<>() : res;
    }
}
